function plotProjectionApp(model,setup)

xPointsDim= 20;
modelPer  = setup.modelPer;
ny        = model.ny;
nx        = model.nx;
Gxx       = reshape(modelPer.gxx,ny,nx^2);
Gxxx      = reshape(modelPer.gxxx,ny,nx^3);

% The grid
dx       = setup.scaleX_in_g*2/(xPointsDim/2-1);
lowerX   = -setup.scaleX_in_g*2;
xGrid    = zeros(nx,xPointsDim);
for j=1:xPointsDim
    xGrid(:,j) = lowerX(:,1)+(j-1)*dx(:,1);
end

stateNames   = model.labelx;
controlNames = model.labely;
for j=1:nx
    figure(j)
    for k=1:ny
        y_per     = zeros(1,size(xGrid,2));
        y_project = zeros(1,size(xGrid,2));
        for i=1:size(xGrid,2)
            x_cu           = zeros(nx,1);
            x_cu(j,1)      = xGrid(j,i);
            AA             = kron3(x_cu,x_cu);
            if setup.appOrderPer == 1
                y_per(1,i)     = modelPer.gx(k,:)*x_cu;
            elseif setup.appOrderPer == 2
                y_per(1,i)     = modelPer.gx(k,:)*x_cu + 0.5*Gxx(k,:)*AA + 0.5*modelPer.gss(k,:);
            elseif setup.appOrderPer == 3
                y_per(1,i)     = modelPer.gx(k,:)*x_cu + 0.5*Gxx(k,:)*AA + 0.5*modelPer.gss(k,:) + ...
                    1/6*Gxxx(k,:)*kron3(AA,x_cu) + 3/6*modelPer.gssx(k,:)*x_cu + 1/6*modelPer.gsss(k,:);
            end
            if setup.appOrder == 1
                y_project(1,i) = model.g0(k,1) + model.gx(k,:)*x_cu;
            elseif setup.appOrder == 2
                y_project(1,i) = model.g0(k,1) + model.gx(k,:)*x_cu + x_cu'*squeeze(model.gxx(k,:,:))*x_cu - modelPer.g0(k,1);
            elseif setup.appOrder == 3
                y_project(1,i) = model.g0(k,1) + model.gx(k,:)*x_cu + x_cu'*squeeze(model.gxx(k,:,:))*x_cu ...
                + reshape(model.gxxx(k,:,:,:),1,nx^3)*kron3(x_cu,AA) - modelPer.g0(k,1);
            end
        end
        subplot(3,2,k);
        hold on
        plot(xGrid(j,:),y_per,'-*r')
        if setup.appOrder == 2
            plot(xGrid(j,:),y_project,'-ob')
        elseif setup.appOrder == 3
            plot(xGrid(j,:),y_project,'-sk')
        end
        title(controlNames(k),'Interpreter','Latex')
        xlabel(stateNames(j),'Interpreter','Latex')
        if k == 1 
            legend({['Per = ',num2str(setup.appOrderPer),'-order']',...
                ['Projection = ',num2str(setup.appOrder),'-order']})
        end
        axis tight
        hold off
    end
end
